/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.sub;

import java.util.Collection;
import java.util.Collections;
import ru.jSkyRoom.bridge.JSkyBridge;
import ru.jSkyRoom.interfaces.major.Quest;
import ru.jSkyRoom.interfaces.sub.JSkyQuestLogEntry;
import skyproc.Condition;
import skyproc.FormID;
import skyproc.QUST.QuestLogEntry;
import skyproc.QUST.QuestLogFlags;

/**
 *
 * @author Rakev
 */
public class QuestLogEntryBridge extends JSkyBridge<QuestLogEntry> implements JSkyQuestLogEntry {

    public QuestLogEntryBridge(QuestLogEntry rawObject) {
        super(rawObject);
    }

    @Override
    public boolean getFlag(QuestLogFlags flag) {
        return getRawObject().get(flag);
    }

    @Override
    public void setFlag(QuestLogFlags flag) {
        getRawObject().set(flag, true);
    }

    @Override
    public void unsetFlag(QuestLogFlags flag) {
        getRawObject().set(flag, false);
    }

    @Override
    public Collection<Condition> getConditions() {
        Collection<Condition> result = getRawObject().getConditions();
        return Collections.unmodifiableCollection(result);
    }

    @Override
    public void addCondition(Condition condition) {
        getRawObject().addCondition(condition);
    }

    @Override
    public void removeCondition(Condition condition) {
        getRawObject().removeCondition(condition);
    }

    @Override
    public String getJournalText() {
        return getRawObject().getJournalText();
    }

    @Override
    public void setJournalText(String text) {
        getRawObject().setJournalText(text);
    }

    @Override
    public Quest getNextQuest() {
        FormID id = getRawObject().getNextQuest();
        return getFinderFactory().createQuestFinder().find(id);
    }

    @Override
    public void setNextQuest(Quest quest) {
        FormID id = getIdProducer().produce(quest);
        getRawObject().setNextQuest(id);
    }

}
